package com.fanhang.samples.spring.hibernate.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate4.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.fanhang.samples.spring.hibernate.dao.RoleDao;
import com.fanhang.samples.spring.hibernate.model.Role;


@Repository
public class RoleDaoImpl extends HibernateDaoSupport implements RoleDao {
	
	@Override
	public int save(Role model) {
		this.getHibernateTemplate().save(model);
		return 1;
	}

	@Override
	public int delete(Integer id) {
		this.getHibernateTemplate().delete(id);
		return 1;
	}

	@Override
	public int update(Role model) {
		this.getHibernateTemplate().update(model);
		return 1;
	}

	@Override
	public Role get(Integer id) {
		return this.getHibernateTemplate().get(Role.class, id);
	}

	@Override
	public List<Role> getList(Role model) {
		return this.getHibernateTemplate().findByExample(model);
	}
	
}
